/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ept.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Khalil
 */
@Entity
@Table(name = "commandeclient", catalog = "final", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Commandeclient.findAll", query = "SELECT c FROM Commandeclient c"),
    @NamedQuery(name = "Commandeclient.findByPrix", query = "SELECT c FROM Commandeclient c WHERE c.prix = :prix"),
    @NamedQuery(name = "Commandeclient.findByIdPanier", query = "SELECT c FROM Commandeclient c WHERE c.idPanier = :idPanier and c.validation = :validation "),
    @NamedQuery(name = "Commandeclient.findByDate", query = "SELECT c FROM Commandeclient c WHERE c.date = :date"),
    @NamedQuery(name = "Commandeclient.findByIdCommande", query = "SELECT c FROM Commandeclient c WHERE c.idCommande = :idCommande")})
public class Commandeclient implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "prix")
    private Integer prix;
    @Column(name = "quantite")
    private Integer quantite;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    @NotNull
    @Column(name = "idCommande", nullable = false)
    private Integer idCommande;
    
    @Lob
    @Size(max = 2147483647)
    @Column(name = "validation", length = 2147483647)
    private String validation;
    @JoinColumn(name = "IdProduit", referencedColumnName = "IdProduit", nullable = false)
    @ManyToOne(optional = false)
    private Produit idProduit;
    @JoinColumn(name = "IdPanier", referencedColumnName = "IdPanier", nullable = false)
    @ManyToOne(optional = false)
    private Panier idPanier;
    

    public Commandeclient() {
    }
    public Commandeclient(Integer idCommande) {
        this.idCommande = idCommande;
    }

    public Integer getQuantite() {
        return quantite;
    }

    public void setQuantite(Integer quantite) {
        this.quantite = quantite;
    }
    
    

    public Integer getPrix() {
        return prix;
    }

    public void setPrix(Integer prix) {
        this.prix = prix;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getIdCommande() {
        return idCommande;
    }

    public void setIdCommande(Integer idCommande) {
        this.idCommande = idCommande;
    }

    public String getValidation() {
        return validation;
    }

    public void setValidation(String validation) {
        this.validation = validation;
    }

    public Produit getIdProduit() {
        return idProduit;
    }

    public void setIdProduit(Produit idProduit) {
        this.idProduit = idProduit;
    }

    public Panier getIdPanier() {
        return idPanier;
    }

    public void setIdPanier(Panier idPanier) {
        this.idPanier = idPanier;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCommande != null ? idCommande.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Commandeclient)) {
            return false;
        }
        Commandeclient other = (Commandeclient) object;
        if ((this.idCommande == null && other.idCommande != null) || (this.idCommande != null && !this.idCommande.equals(other.idCommande))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ept.entities.Commandeclient[ idCommande=" + idCommande + " ]";
    }

    public void setIdProduit(Integer idProduit) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
